/**
 * Created by mapbar_front on 2019/8/12.
 */
import React,{Component,StrictMode} from 'react';

function add(a,b){
    return a + b;
}
function sub(a,b){
    return a - b;
}
var res = sub.call(add,2,1);
console.log('res',res);


class ComponentOne extends Component{
    constructor(props){
        super(props);
        this.state = {
            name: '',
        }
    }
    componentWillMount(){
        this.setState({
            name: this.props.name
        })
    }
    render(){
        return(
            <div>
                name:{this.state.name}
            </div>
        )
    }
}
function ComponentTwo(){
    return <div>
        ComponentTwo
    </div>
}

class Strict extends Component{
    constructor(props){
        super(props);
        this.myRef = React.createRef();
        //SharedApplicationState.recordEvent('ExampleComponent');
    }
    componentDidMount(){
        this.myRef.current.focus();
        this.refs.myInput.focus();
    }
    render(){
        return(
            <div>
                <StrictMode>
                    <div>
                        {/*<ComponentOne name="xiao"/>*/}
                        <ComponentTwo/>
                        <input type="text" ref={this.myRef}/>
                        <br/>
                        <input type="text" ref="myInput"/>
                    </div>
                </StrictMode>
            </div>
        )
    }
}
export default Strict;
